package sc.hibernate.models;

import java.util.*;
import javax.persistence.*;

/**
 * Hibernate model entity for sector
 * 
 *  A sector has many companies
 * 
 * @author Cédric Rais
 *
 */
@Entity
@Table( name = "sector" )
public class Sector{
	
	@Id
	private Integer id;
	private String name;
	private Float pe_avg;
	private Float roa_avg;
	private Float roe_avg;
	private Float current_avg;
	private Float inventory_turnover_avg;
	private Float pretax_profit_margin_avg;
	
	@ManyToMany
	@JoinTable(name="comp_sec",
				joinColumns={@JoinColumn(name="SEC_ID")},
				inverseJoinColumns={@JoinColumn(name="SYMBOL")})
	private Set<Company> companies = new HashSet<Company>();
	
	public Sector(){}
	
	public Sector(Integer id, String name){
		this.id = id;
		this.name = name;
	}
	
	//--------------------------------------------------------------------------
	// Primary Key
	//--------------------------------------------------------------------------
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	//--------------------------------------------------------------------------
	// Associations
	//--------------------------------------------------------------------------
	public Set<Company> getCompanies() {
		return companies;
	}
	public void setCompanies(Set<Company> companies) {
		this.companies = companies;
	}
	
	//--------------------------------------------------------------------------
	// Fields
	//--------------------------------------------------------------------------
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public Float getPe_avg() {
		return pe_avg;
	}
	public void setPe_avg(Float pe_avg) {
		this.pe_avg = pe_avg;
	}

	
	public Float getRoa_avg() {
		return roa_avg;
	}
	public void setRoa_avg(Float roa_avg) {
		this.roa_avg = roa_avg;
	}

	
	public Float getRoe_avg() {
		return roe_avg;
	}
	public void setRoe_avg(Float roe_avg) {
		this.roe_avg = roe_avg;
	}

	
	public Float getCurrent_avg() {
		return current_avg;
	}
	public void setCurrent_avg(Float current_avg) {
		this.current_avg = current_avg;
	}

	
	public Float getInventory_turnover_avg() {
		return inventory_turnover_avg;
	}
	public void setInventory_turnover_avg(Float inventory_turnover_avg) {
		this.inventory_turnover_avg = inventory_turnover_avg;
	}

	
	public Float getPretax_profit_margin_avg() {
		return pretax_profit_margin_avg;
	}
	public void setPretax_profit_margin_avg(Float pretax_profit_margin_avg) {
		this.pretax_profit_margin_avg = pretax_profit_margin_avg;
	}
}
